#include <pthread.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>

static void *thr_job(void *s);

int main(void)
{
	pthread_t tid;
	int err;
	int i = 0;

	err = pthread_create(&tid, NULL, thr_job, NULL);
	if (err) {
		fprintf(stderr, "Error creating thread: %s\n", strerror(err));
		exit(1);
	}

	sleep(1);

	while (i < 10) {
		write(1, "*", 1);
		sleep(2);
		i++;
	}

	pthread_join(tid, NULL);

	return 0;
}

static void *thr_job(void *s)
{
	int i = 0;

	while (i < 5) {
		write(1, "!", 1);
		sleep(2);
		i++;
	}
}
